package model.sqlite;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import model.TypeOperation;
import model.TypeOperationDAO;

public class SqliteTypeOperationDAO implements TypeOperationDAO
{
	private Connection conn;
	
	public SqliteTypeOperationDAO(Connection conn)
	{
		this.conn = conn;
	}
	
	@Override
	public TypeOperation findTypeOperation()
	{
		try
		{
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery( "SELECT * FROM type_operation;" );
			while ( rs.next() )
			{
		         int id = rs.getInt("id");
		         String  name = rs.getString("type");
		         System.out.println("ID= " + id);
		         System.out.println("Type Operation= " + name);
			}
			
			rs.close();
		    stmt.close();
		}
		catch (SQLException e)
		{
			System.err.println( e.getClass().getName() + ": " + e.getMessage() );
		}
		
		
		return null;
	}	
}
